Skip to content

ETT-1394 address warning: "CGI::Param called in list context"#234

Open
moseshll wants to merge 7 commits into
mainfrom
ETT-1394_cgi_param_list_context
Open

ETT-1394 address warning: "CGI::Param called in list context"#234
moseshll wants to merge 7 commits into
mainfrom
ETT-1394_cgi_param_list_context

Conversation

@moseshll

@moseshll moseshll commented Jun 26, 2026

Copy link
Copy Markdown
Contributor
  • Include mb/t/ in perl-test

  • Address and test LS::PIFiller::ListSearchResults::handle_ANALYTICS_REPORT_URL_PI

  • Address and test MBooks::PIFiller::ListUtils::handle_ANALYTICS_REPORT_URL_PI

  • Address issue in MBooks::Operation::LogoutTrap::redirect_and_exit

    • Not really testable for reasons cited in ticket:

    Perl gets mad at the exit call and complains “A context appears to have been destroyed without first calling release…” with a half page of noise.

    • The function in question calls exit and it appears its call to MBooks::View::P_redirect_HTTP also calls exit.
    • I had a go with Test::Trap and Test::Exit but to no avail.
  • Address issue in PT::Prolog::Run

    • No tests because the method is enormous and the prospect of scaffolding a unit test is daunting.

There are no other issues flagged in the error logs I could find in the past 30 days.

moseshll added 5 commits June 26, 2026 16:45
  - Fix and tests for `handle_ANALYTICS_REPORT_URL_PI`
- Not really testable for reasons cited in ticket
- No tests because the method is enormous and the prospect of scaffolding a unit test is daunting.
@moseshll moseshll marked this pull request as ready for review June 29, 2026 13:40
@moseshll moseshll requested a review from aelkiss June 29, 2026 13:41

@aelkiss aelkiss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual fixes look good.

Looking at the tests, it doesn't seem like they'd fail if the changes in the code weren't there. Maybe worth considering if there's any reasonable way to test that there are no warnings, if it's easy (see e.g. https://perlmaven.com/test-for-warnings-in-a-perl-module)? That said, the tests can at least serve as regression tests if nothing else, if we aren't easily able to test the lack of warnings.

foreach my $param ( $cgi->param ) {
if ( $param =~ m,q[0-9]|field[0-9]|anyall[0-9]|op[0-9]|lmt, ) {
$tempCgi->param($param, $cgi->param($param));
$tempCgi->param($param, $cgi->multi_param($param));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could just call scalar here. I don't know if it is possible to ever have multiple values for the params referenced above, and additionally I don't know if it matters for the analytics report URL, or indeed if we even care.

…ere are none in the PIFiller tests.

- We can probably use this approach when we get around to the Date::Manip warnings, and anything else
  clogging the logs.
@moseshll

Copy link
Copy Markdown
Contributor Author

@aelkiss This latest addition was a useful one, as noted, when we tackle Date::Manip and other nonsense clogging up the logs.

Comment thread ls/t/LS/PIFiller/ListSearchResults.t Outdated
};

subtest 'check for accumulated warnings' => sub {
is(scalar @warnings, 0, 'no warnings encountered');

@aelkiss aelkiss Jun 29, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The approach of checking for warnings looks good; I would feel better about putting the check in each subtest rather than its own thing though, since typically we want tests to be isolated/not dependent on other tests (& likewise in ListUtils.t)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in the latest commit.

- Clean up and fix some outdated comments.
@moseshll moseshll requested a review from aelkiss June 30, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants